using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System.Collections;
using CreamX.Framework.Game;

namespace CreamX.Framework.Text
{
    /// <summary>
    /// This was just a hack to get something quick and easy to use.
    /// not sure its needed at all now, but could possibly be extended to make it useful.
    /// </summary>
    public class TextEngine
    {
        public static TextEngine Instance;
        static TextEngine()
        {
            Instance = new TextEngine();
        }
        public TextEngine()
        {
            Fonts = new Dictionary<int, SpriteFont>();
        }
        //public void DrawText(string texttodraw, int fontname, Vector2 position,Color color)
        //{
        //    SpriteFont __font = GetFont(fontname);
        //    SpriteBatch __b = new SpriteBatch(CreamXGame.Instance.graphics.GraphicsDevice);
        //    __b.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
        //    __b.DrawString(__font, texttodraw, position, color);
        //    __b.End();
        //}
        public void DrawText(SpriteBatch __b, string texttodraw, int fontname, Vector2 position, Color color)
        {
            SpriteFont __font = GetFont(fontname);
            if(texttodraw!=null)
                __b.DrawString(__font, texttodraw, position, color);
            
        }
        public void DrawText(SpriteBatch __b, string texttodraw, int fontname, Vector2 position, Color color,float scale)
        {
            SpriteFont __font = GetFont(fontname);

            __b.DrawString(__font, texttodraw, position, color,0,Vector2.Zero,scale,SpriteEffects.None,0);

        }
        
        
        public SpriteFont GetFont(int id)
        {
            return Fonts[id];
        }

        public Dictionary<int, SpriteFont> Fonts;
    }

    public enum FontNames
    {
        Arial,
        ArialSmall,
        GameFont,
        MenuFont,
        ChalkBoard
    }
}
